﻿using Compass.Wasm.Shared.Purchases;
using Zack.DomainCommons.Models;

namespace Compass.PurchaseService.Domain.Entities;

public record NavInvValuation : AggregateRootEntity
{
    public string Number { get; private set; }
    public DateTime YearMonth { get; private set; }
    public double IncreaseQuantity { get; private set; }
    public double IncreaseValue { get; private set; }
    public double DecreasesQuantity { get; private set; }
    public double DecreasesValue { get; private set; }

    private NavInvValuation() { }

    public NavInvValuation(Guid id, string number,DateTime yearMonth, double increaseQuantity, double increaseValue, double decreasesQuantity, double decreasesValue)
    {
        Id = id;
        Number = number;
        YearMonth = yearMonth;
        IncreaseQuantity = increaseQuantity;
        IncreaseValue = increaseValue;
        DecreasesQuantity = decreasesQuantity;
        DecreasesValue = decreasesValue;
    }

    #region Update
    public void Update(NavInvValuationDto dto)
    {
        ChangeNumber(dto.Number)
            .ChangeYearMonth(dto.YearMonth)
            .ChangeIncreaseQuantity(dto.IncreaseQuantity)
            .ChangeIncreaseValue(dto.IncreaseValue)
            .ChangeDecreasesQuantity(dto.DecreasesQuantity)
            .ChangeDecreasesValue(dto.DecreasesValue);

        NotifyModified();
    }

    public NavInvValuation ChangeNumber(string number)
    {
        Number=number;
        return this;
    }
    public NavInvValuation ChangeYearMonth(DateTime yearMonth)
    {
        YearMonth=yearMonth;
        return this;
    }
    public NavInvValuation ChangeIncreaseQuantity(double increaseQuantity)
    {
        IncreaseQuantity= increaseQuantity;
        return this;
    }
    public NavInvValuation ChangeIncreaseValue(double increaseValue)
    {
        IncreaseValue= increaseValue;
        return this;
    }
    public NavInvValuation ChangeDecreasesQuantity(double decreasesQuantity)
    {
        DecreasesQuantity= decreasesQuantity;
        return this;
    }
    public NavInvValuation ChangeDecreasesValue(double decreasesValue)
    {
        DecreasesValue= decreasesValue;
        return this;
    }

    #endregion
}